package cn.llssit.project.wechatapi.controller;

import cn.llssit.project.wechatapi.domain.Orders_Person_Detail;
import cn.llssit.project.wechatapi.domain.Seat;
import cn.llssit.project.wechatapi.mapper.OrdersMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Author: Lesan
 * @Date: 2020-06-12
 */
@Controller
@RequestMapping("/wechatapi")
public class WcOrdersController {
    @Autowired
    private OrdersMapper ordersMapper;

    @GetMapping("/addorder")
    public ResponseEntity<Object> addorder(Integer Mid, Integer Vid, Integer clmn, Integer rws, Double price, String time, Integer Fid, Integer Rid) {
        ordersMapper.addOrder(Mid, Vid, clmn, rws, price, time, Fid,Rid);
        return new ResponseEntity<>(HttpStatus.OK);
    }

    @GetMapping("/isbought")
    @ResponseBody
    public List<Seat> boughtTicket(Integer Mid){
        return ordersMapper.boughtTicket(Mid);
    };

    @GetMapping("/myorders")
    @ResponseBody
    public List<Orders_Person_Detail> myorders(Integer Rid){
        return ordersMapper.myOrders(Rid);
    };
}
